package xkp.lesson2;

public class Demo1 {
	public static void main(String[] args) {
		Car car = new Car("豫And250", "宝马");
		Person person1 = new Person("张三", 20, car);
		//使用person1q去初始化另外一个person对象
		Person person2 = new Person(person1);
		//原则上来说person1和person2应该是两个完全不同的对象
		//两者应该本质上相互独立,只是信息一致

		person1.setAge(200);
		person1.setName("李四");
		person1.getCar().setNumber("123");
		System.out.println(person1.getName()+":"+person1.getAge()+":"+person1.getCar().getNumber());
		System.out.println(person2.getName()+":"+person2.getAge()+":"+person2.getCar().getNumber());
	}

}
